﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;
using FarseerPhysics.SamplesFramework;

namespace BattleToast
{
    public class GameObject
    {   
        //private Vector2 position;       //pozicija na sprajt
        private Vector2 size;           //sirina na sprajt        
        private Texture2D texture;      //tekstura na sprajt
        private Vector2 position;
        private Body body;

        public Body Body
        {
            get { return body; }
            set { body = value; }
        }

        public Vector2 Position
        {
            get { return position; }
            set { position = value; }
        }
        private Vector2 origin;


        public Vector2 Origin
        {
            get { return origin; }
            set { origin = value; }
        }

        public Vector2 Size
        {
            get { return size; }
            set { size = value; }
        }

        public Texture2D Texture
        {
            get { return texture; }
            set { texture = value; }
        }

        public GameObject() { }

        public GameObject( Texture2D texture)
        { 
            this.texture = texture;            
        }


        public void Move(Vector2 speed)
        {
            Vector2 direction= new Vector2(-1,0);
            this.position += direction*speed;
            this.Body.Position += direction * ConvertUnits.ToSimUnits(speed);
        }
        public void MoveBack(Vector2 speed)
        {
            Vector2 direction = new Vector2(-1, 0);
            this.position += direction * speed;
        }
        public bool OffScreen()
        {
          return  (this.position.X + this.size.X < 0) ? true : false;
        }
    }
}
